package com.huawei.crm.sample.adapter.inbound.rest.order.converter;

import com.huawei.crm.sample.adapter.inbound.rest.order.request.OrderReq;
import com.huawei.crm.sample.application.order.dto.OrderDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
import java.util.List;

@Mapper(componentModel = "spring")
public interface OrderReqConverter {

    @Mapping(target = "items", source = "items")
    OrderDTO toDTO(OrderReq req);
    @Mapping(target = "items", source = "items")
    OrderReq toReq(OrderDTO dto);

    OrderDTO.OrderItemDTO toItemDTO(OrderReq.OrderItemReq req);
    OrderReq.OrderItemReq toItemReq(OrderDTO.OrderItemDTO dto);

    List<OrderDTO.OrderItemDTO> toItemDTOList(List<OrderReq.OrderItemReq> reqs);
    List<OrderReq.OrderItemReq> toItemReqList(List<OrderDTO.OrderItemDTO> dtos);
} 